package com.lagou.controller;

import com.lagou.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @PostMapping("/create/{email}")
    public boolean createCode(@PathVariable("email") String email) {
        return codeService.createCode(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public int validateCode(@PathVariable("email") String email,@PathVariable("code") String code) {
        return codeService.validateCode(email,code);
    }

}
